package com.easy.module.generator.model;

import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;

@Setter
@Getter
public class CodeModel implements Serializable {
    static final long serialVersionUID = 1L;

    private String code;

    private String filename;

    private String ftl;

    private String language;

    public CodeModel(String ftl) {
        this.ftl = ftl;
    }

    public CodeModel(String ftl, String filename) {
        this.ftl = ftl;
        this.filename = filename;
        this.language = ftl.substring(ftl.lastIndexOf(".")+1);
        if(this.language.equals("ts")) {
            this.language = "typescript";
        }
    }

    public CodeModel(String ftl, String filename, String language) {
        this.ftl = ftl;
        this.filename = filename;
        this.language = language;
    }

    public CodeModel() {
    }
}
